version: '3'

services:
  load_balancer:
    image: nginx:1.25
    container_name: load-balancer
    ports:
      - "80:80"
      - "443:443"
    networks:
      - frontend
      - backend
    volumes:
      - "./www-data/nginx.conf:/etc/nginx/nginx.conf"
      - "./www-data/flask.crt:/etc/nginx/ssl/flask.crt"
      - "./www-data/flask.key:/etc/nginx/ssl/flask.key"

  flask1:
    build: .
    hostname: flask1
    container_name: flask-app1
    networks:
      - backend

  flask2:
    build: .
    hostname: flask2
    container_name: flask-app2
    networks:
      - backend

networks:
  frontend:
  backend:
